﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSharpAlgorithm
{
    class Roulette
    {
        public Roulette()
        {
            int count = 0;

            int money = 1000;
            int betting = 1;
            int win = 0;
            int lose = 0;
            Random r = new Random(DateTime.Now.Second);
            while (money > 0)
            {
                count++;
                //Console.WriteLine("*****" + count + "*****");
                //Console.WriteLine("배팅액 : " + betting + "만원");
                
                
                int value = r.Next(0,999);
                if (value % 2 == 0)
                {
                    money += betting;
                    betting = 1;
                    //Console.WriteLine("성공!!!");
                    win++;
                }
                else
                {
                    money -= betting;
                    betting *= 2;
                    if (betting > 30)
                    {
                        betting = 30;
                    }
                    lose++;
                    //Console.WriteLine("실패 ㅜㅜ");
                }
                Console.WriteLine("남은 금액 : " + money + "만원, 판돈 : " + betting / 2);
            }
            Console.WriteLine("남은 금액 : " + money + "만원, 판돈 : " + betting / 2);
            Console.WriteLine("Win:" + win + " Lose:" + lose);
        }
    }
}
